package Dome0;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;

public class Text0 {
    public static void main(String[] args) {
        LinkedList<Integer> linkedList = new LinkedList<>();
        linkedList.add(1);
        linkedList.add(2);
        linkedList.add(3);
        linkedList.add(4);
        linkedList.add(5);
        Iterator<Integer> iterator1 = linkedList.iterator();
        while(iterator1.hasNext()){
            System.out.println(iterator1.next());
        }
        System.out.println("=====================");
        ListIterator<Integer> iterator2 = linkedList.listIterator(linkedList.size());
        while (iterator2.hasPrevious()){
            System.out.println(iterator2.previous());
        }
    }
}
